/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package maincz.tests.webapp.service;

import java.util.List;
import java.util.logging.Logger;
import maincz.tests.webapp.dao.IContactDAO;
import maincz.tests.webapp.entity.contactbook.Contact;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Main
 */
@Service
public class ContactService implements IContactService {

    @Autowired
    private IContactDAO contactDAO;

    private static final Logger log = Logger.getLogger("MyLogger");

    public ContactService() {
        super();
        log.info("constructor ContactServiceImpl");
    }

    @Override
    @Transactional
    public void addContact(Contact contact) {
        this.contactDAO.addContact(contact);
    }

    @Override
    @Transactional
    public List<Contact> listContacts() {
        return this.contactDAO.listContacts();
    }

    @Override
    @Transactional
    public void removeContact(Long id) {
        this.contactDAO.removeContact(id);
    }

    public IContactDAO getContactDAO() {
        return contactDAO;
    }

    public void setContactDAO(IContactDAO contactDAO) {
        this.contactDAO = contactDAO;
    }

}
